<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="org.limp.mine.StringTool"%>
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>
<%@ page import="org.limp.mine.DateTrimmer"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[]) request.getAttribute("result");
	Label label = (Label) result[1];
	Controller controller = (Controller) result[2];
	String pageNO = (String) result[3];
	List resultList = (List) result[0];

	String v_jsy_xm = (String) request.getAttribute("v_jsy_xm");//姓名
	String v_jsy_dw = (String) request.getAttribute("v_jsy_dw");//单位
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>驾驶员列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../../head.jsp"></jsp:include>
<script language="javascript">
  var chk = false;
  function checkall(thizz){
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox"){
        chks[i].checked = !chk;
      }
    }
    
    chk = !chk;
  }
  
  function handleDelete(){
    var rnt = false;
    var ids = "";
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox" && chks[i].checked){
        rnt = true;
        ids += chks[i].value + ",";
      }
    }
    
    if(!rnt){
      alert("请选择要删除的驾驶员");
    }else if(confirm("确定删除")){
      createHidden("ids",ids.substring(0,ids.length - 1));
      document.form1.action = "<%=context%>/app/jsy.do?method=delete";
      document.form1.submit();
    }
  }
  
  function handleQuery(){
    document.form1.action = context + "/app/jsy.do?method=list";
    document.form1.submit();
  }
  
  function handleInsert(){
      var url = "<%=context%>/app/jsy.do?method=neu";
      window.location.href = url;
  }
  
  function handleEdit(id){
      var url = "<%=context%>/app/jsy.do?method=edit&id=" + id;
      window.location.href = url;
  }  
   
  function handleReresh(){
      window.location.href = context + "/app/jsy.do?method=list&pageNO=<%=pageNO%>";
  }
</script>
<body>
<form name="form1" method="post" action=""><input type="hidden"
	name="pageNO" value="<%=pageNO%>">
<div>
驾驶员姓名 <input style="width:100px;" type="text"
			class="box3" name="v_jsy_xm" value="<%=v_jsy_xm%>"> 单位 <input
			type="text" style="width:100px;" class="box3" name="v_jsy_dw" value="<%=v_jsy_dw%>">
		    <img src="/app/info/images/search.png" title="查询驾驶员信息" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleQuery();"/>查 询
			<img src="/app/info/images/addinfo.png" title="新增驾驶员信息" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleInsert();"/>新 建
            <img src="<%=context %>/app/info/images/page_white_delete.png" title="删除驾驶员信息" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleDelete();"/>删 除
</div>
<table class="tbl" align="center" width="98%">
	<thead>
	<tr>
		<td class="td1" title="全部选择/取消选择" onclick="javascript:checkall();"
			width="10" align="center">&nbsp;</td>
		<td class="td1" width="20%">&nbsp;驾驶员姓名</td>
		<td class="td1" width="40%">&nbsp;单位</td>
		<td class="td1" width="10%">&nbsp;性别</td>
		<td class="td1" width="20%">&nbsp;准驾车类</td>
	</tr>
	</thead>
	<%
			if (resultList != null && !resultList.isEmpty()) {

			for (int i = 0; i < resultList.size(); i++) {
				Map info = (Map) resultList.get(i);
				String number = (String) info.get("PAGINATION_NUMBER");

				String jsy_id = StringTool.checkString(info.get("JSY_ID"));// ID
				String jsy_dw = StringTool.checkString(info.get("JSY_DW"));//单位
				String jsy_xm = StringTool.checkString(info.get("JSY_XM"));//姓名
				String jsy_xb = StringTool.checkString(info.get("JSY_XB"));//性别
				String jsy_csny = StringTool.checkString(info
				.get("JSY_CSNY"));//出生年月
				String jsy_sfzh = StringTool.checkString(info
				.get("JSY_SFZH"));//身份证号
				String jsy_jszh = StringTool.checkString(info
				.get("JSY_JSZH"));//驾驶证号
				String jsy_zjcl = StringTool.checkString(info
				.get("JSY_ZJCL"));//准驾车类
				String jsy_clzrq = StringTool.checkString(info
				.get("JSY_CLZRQ"));//初领证日期
				String jsy_jszyxny = StringTool.checkString(info
				.get("JSY_JSZYXNY"));//驾驶证有效年月
				String jsy_glkyxq = StringTool.checkString(info
				.get("JSY_GLKYXQ"));//管理卡有效期
				String jsy_xcsyrq = StringTool.checkString(info
				.get("JSY_XCSYRQ"));//下次审验日期
				String jsy_jtdz = StringTool.checkString(info
				.get("JSY_JTDZ"));//家庭地址
	%>
	<tr onMouseOver="javascript:this.bgColor='#ffff99'"
		onmouseout=" javascript:this.bgColor='#ffffff'" bgColor="#ffffff">
		<td align="center"><input type="checkbox" name="chk"
			value="<%=jsy_id%>"></td>
		<td>&nbsp;<a
			href="javascript:void(0);" onclick="javascript:handleEdit('<%=jsy_id%>');"><%=jsy_xm%></a></td>
		<td>&nbsp;<%=jsy_dw%></td>
		<td>&nbsp;<%=jsy_xb.equals("1") ? "男" : "女"%></td>
		<td>&nbsp;<%=jsy_zjcl%></td>
	</tr>
	<%
		}
		}
	%>
</table>
<table width="98%" class="tab-noborder" align="center">
	<tr>
		<td><%=label.displayLabel()%></td>
		<td align="right"><%=label.startLabel()%> <%=label.previousLabel()%>
		<%=label.nextLabel()%> <%=label.endLabel()%> <%=controller.getController().toString()%>
		</td>
	</tr>
</table>
<%=controller.getControlScript(true)%></form>
</body>
</html>
